<%@ include file="includeTop.jsp" %>
<html>
<head>
<title></title>
<%@ include file="includeTop_head.jsp" %>
</head>
<body>
<table width="100%" align="center" style="padding:0;margin:0" border=0>
<tr><td align="center" colspan="3"><%@ include file="user_status.jsp" %></td></tr>

<tr><td width="10%"></td><td align="center"><%@ include file="title.jsp" %></td>
    <td><%@ include file="buystep.jsp" %></td>
</tr>
<tr><td align="center" colspan="5">
<!-- cart -->
<table class="step" id="cart" border="0" width="80%" cellspacing="0" cellpadding="0">
<tr>
<th valign="top" align="center" colspan="100" valign="middle"> Shopping Cart </th>
</tr>
<tr height="10">
<td></td>
</tr>
<tr>
<td align="center" valign="middle" colspan="3">
<form action="<c:url value="/updateCart.do"/>" method="post">
<table width="98%" class="redlight" align="center" border="0" cellspacing="2" cellpadding="5">
  <tr>
  <th>Item ID</th>  
  <th>Product Number</th>  
  <th>Product</th> 
  <th>In Stock?</th> 
  <th>Quantity</th>  
  <th>Unit Price</th> 
  <th>Total Cost</th>  
  <th>Delete Item</th>
  </tr>

<c:if test="${cart.numberOfItems == 0}">
<tr ><td colspan="8"><b>Your cart is empty.</b></td></tr>
</c:if>

<c:forEach var="cartItem" items="${cart.cartItemList.pageList}">
  <tr  height="25">
  <td><b>
  <a href="<c:url value="/shop/viewItem.do"><c:param name="itemId" value="${cartItem.item.itemId}"/></c:url>">
    <c:out value="${cartItem.item.itemId}"/>
  </a></b></td>
  <td><c:out value="${cartItem.item.product.productNo}"/></td>
  <td>
    <c:out value="${cartItem.item.attribute1}"/>
    <c:out value="${cartItem.item.attribute2}"/>
    <c:out value="${cartItem.item.attribute3}"/>
    <c:out value="${cartItem.item.attribute4}"/>
    <c:out value="${cartItem.item.attribute5}"/>
    <c:out value="${cartItem.item.product.name}"/>
   </td>
  <td align="center"><c:out value="${cartItem.inStock}"/></td>
  <td align="center">
  <input type="text" size="3" name="<c:out value="${cartItem.item.itemId}"/>" value="<c:out value="${cartItem.quantity}"/>" />
  </td>
  <td align="right"><fmt:formatNumber value="${cartItem.item.product.unitPrice}" pattern="$#,##0.00" /></td>
  <td align="right"><fmt:formatNumber value="${cartItem.totalPrice}" pattern="$#,##0.00" /></td>
  <td align="center"><a href="<c:url value="/removeItem.do"><c:param name="itemId" value="${cartItem.item.itemId}"/></c:url>">
    <img border="0" src="<%=contextPath%>/image/button_remove.gif" />
  </a></td>
  </tr>
</c:forEach>
<tr height="30">
<th colspan="10" align="right" >
<c:if test="${cart.numberOfItems > 0}">
<input alt="Update Cart" src="<%=contextPath%>/image/pc_button_updatecart.gif" type="image" name="updateCart"  id="updateCart" onclick=""/>
</c:if>
<br></br>
<b>Sub Total (exclude shipping): <fmt:formatNumber value="${cart.subTotal}" pattern="$#,##0.00" /></b><br/>
</th>
</tr>
</table>
</form>
<br></br>
<input alt="Continue Shopping" src="<%=contextPath%>/image/pc_button_continue_shop.gif" type="image" name="continueShopping"  id="continueShopping" 
      onclick="window.open('<c:url value="/"/>', '_self')"/>
<c:if test="${cart.numberOfItems > 0}">
<a href="<c:url value="/order/checkout.do"/>"><input alt="Checkout" src="<%=contextPath%>/image/pc_button_checkout.gif" type="image" name="checkout"  id="checkout" onclick="window.open('<c:url value="/checkout.do"/>', '_self')"/></a>

</c:if>
<br></br>
</td>
</tr>
</table>
<!-- cart end -->
</td></tr>
<tr><td align="center" colspan="3">
<%@ include file="includeBottom.jsp" %></td></tr>
</table>
</body>
</html>
